/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Servlet.supplier;

import Model.Product.ProductList;
import RssEasy.Core.HttpRequestHelper;
import RssEasy.Core.SignVerifyRequestHelper;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author admin
 */
@WebServlet(name = "particular", urlPatterns = {"/supplier/particular/*"})
public class particular extends SignVerifyRequestHelper {

    @Override
    protected HttpRequestHelper request(HttpServletRequest request, HttpServletResponse response) {
        super.request(request, response);
        try {
            ProductList list = new ProductList(pageContext);
            list.select().where("id=?", request.getParameter("id")).get_first_rows();
            out.print(list.toKeyValue());
        } catch (Exception e) {
            out.print("{\"error\":\"" + e.getMessage() + "\"}");
        }
        return this;
    }

}
